import java.util.Arrays;

class PriorityQueue
{
    public static int[]elem;
    public static int usesized;
    public PriorityQueue()
    {
        elem=new int[10];
    }
    public static void ininum(int[]arry)
    {
        int i=0;
        for(i=0;i<arry.length;i++)
        {
            elem[i]=arry[i];
            usesized++;
        }
    }
    public static void creat()
    {
        for(int parent=(usesized-1-1)/2;parent>=0;parent--)
        {
            shit(usesized,parent);
        }

    }
    public static void shit(int len,int parent)
    {
        int child=2*parent+1;
        while(child<len)
        {
            if(child+1<len&&elem[child]<elem[child+1])
            {
                child++;

            }


                if(elem[child]>elem[parent])
                {
                    int tmp=elem[child];
                    elem[child]=elem[parent];
                    elem[parent]=tmp;
                    parent=child;
                    child=2*parent+1;
                }
                else
                {
                    break;
                }

        }
    }
    public static void offer(int num)    //增加一元素，把它放在最后面，然后再进行调整
    {
        if(isfull())
        {
            elem= Arrays.copyOf(elem,2*elem.length);
        }
        elem[usesized]=num;
        usesized++;
        int child1=usesized-1;
        int parent1=(child1-1)/2;
        while(parent1>=0)
        {
            if(elem[child1]>elem[parent1])
            {
                int tmp=elem[child1];
                elem[child1]=elem[parent1];
                elem[parent1]=tmp;
                child1=parent1;
                parent1=(child1-1)/2;
            }
            else
            {
                break;
            }

        }
    }
    public static int peek()
    {
        return elem[0];
    }
    public static boolean isfull()
    {
        return usesized==10;
    }
    public static void shanchu()      //删除元素只能删除最顶端的元素，做法是把最后的元素和最顶端的元素进行交换，然后再把祖先结点进行调整成大根堆，
                                     // 不需要调整所有的结点,只有祖先结点需要调整
    {

            int tmp = elem[0];
            elem[0] = elem[usesized - 1];
            elem[usesized - 1] = tmp;
            usesized--;

            shit(usesized, 0);





    }
    public void paixu() {
        while (usesized >= 1) {
            int tmp1 = elem[0];
            elem[0] = elem[usesized - 1];
            elem[usesized - 1] = tmp1;
            usesized--;

            shit(usesized, 0);


        }
    }
    public static boolean empty()
    {
        return usesized==0;
    }










    }








public class text1 {
    public static void main1(String[] args) {
        PriorityQueue a=new PriorityQueue();
        int[]num={27,15,19,18,28,34,65,49,25,37};
        a.ininum(num);
        a.creat();
    //a.offer(90);
       //a.shanchu();
        //int[]arr=PriorityQueue.elem;
        a.paixu();
        int[]arr=PriorityQueue.elem;
       System.out.println(1);
        //System.out.println(a.peek());




    }


}
